package com.ztmg.water.controller.recycle;

import com.ztmg.common.util.resultUtils.JsonResult;;
import com.ztmg.water.vo.recycle.TicketRecycleRecordAllVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import com.github.pagehelper.PageInfo;


import com.ztmg.water.vo.recycle.TicketRecycleRecordVO;
import com.ztmg.water.dto.recycle.TicketRecycleRecordDTO;
import com.ztmg.water.dto.recycle.TicketRecycleRecordPageDTO;
import com.ztmg.water.service.recycle.TicketRecycleRecordService;


/**
 * 
 * TicketRecycleRecordControllerController
 * 
 **/

@Api(description = "水票回收接口")
@RestController
@RequestMapping(value = "/ticketRecycleRecord")
public class TicketRecycleRecordController{

	@Resource
	private TicketRecycleRecordService ticketRecycleRecordService;

    @PostMapping("create")
    @ApiOperation("新增")
    public JsonResult create(@RequestBody TicketRecycleRecordDTO dto){
        return ticketRecycleRecordService.create(dto);
    }

    @PostMapping("auditTicktRecycleRecord")
    @ApiOperation("审核回收申请")
    public JsonResult auditTicktRecycleRecord(@RequestBody TicketRecycleRecordDTO dto){
        return ticketRecycleRecordService.updateRecordStatus(dto);
    }

    @PostMapping("update")
    @ApiOperation("修改")
    public JsonResult update(@RequestBody TicketRecycleRecordDTO dto){
        return ticketRecycleRecordService.update(dto);
    }

    @GetMapping("detail/{id}")
    @ApiOperation("详情")
    public JsonResult<TicketRecycleRecordVO> detail(@PathVariable Integer id){
        return ticketRecycleRecordService.selectById(id);
    }

    @GetMapping("selectTicketRecycleById/{id}")
    @ApiOperation("详情")
    public JsonResult<TicketRecycleRecordAllVO> selectTicketRecycleById(@PathVariable Integer id){
        return ticketRecycleRecordService.selectTicketRecycleById(id);
    }

    @PostMapping("select")
    @ApiOperation("条件查询")
    public JsonResult<TicketRecycleRecordVO> detail(@RequestBody TicketRecycleRecordDTO dto){
        return ticketRecycleRecordService.select(dto);
    }

    @PostMapping("queryPage")
    @ApiOperation("分页查询")
    public JsonResult<PageInfo<TicketRecycleRecordVO>> queryPage(@RequestBody TicketRecycleRecordPageDTO dto){
        return ticketRecycleRecordService.selectPage(dto);
    }

    @PostMapping("queryAllPage")
    @ApiOperation("分页查询")
    public JsonResult<PageInfo<TicketRecycleRecordAllVO>> queryAllPage(@RequestBody TicketRecycleRecordPageDTO dto){
        return ticketRecycleRecordService.selectListAllPage(dto);
    }

    @PostMapping("delete")
    @ApiOperation("条件删除")
    public JsonResult delete(@RequestBody TicketRecycleRecordDTO dto){
        return ticketRecycleRecordService.delete(dto);
    }

    @GetMapping("deleteById/{id}")
    @ApiOperation("删除")
    public JsonResult deleteById(@PathVariable Integer id){
        return ticketRecycleRecordService.deleteById(id);
    }

}